package com.sky.mapper.admin;


import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.enumeration.OperationType;
import com.sky.pojo.Employee;
import org.apache.ibatis.annotations.*;



public interface EmployeeMapper {
    /*
     * 修改员工信息
     * */
    @AutoFill(OperationType.UPDATE)
    void update(Employee employee);
    /*
     * 根据id查询员工
     * @param id
     * */
    @Select("select * from employee where id = #{id}")
    Employee selectById(Long id);

    /*
    * 启用禁用员工账号
    * */
    @AutoFill(OperationType.UPDATE)
    int updateStatusById(Employee employee);

    /*
     *
     * 员工管理分页查询
     * @param String name
     * @return Page<Employee>
     * */
    Page<Employee> selectPageByName(String name);

    /**
     * 根据用户名查询员工
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);
    /*
    * 新增员工
    * @param employee
    * */

    @Insert("insert into employee (username, name, password, phone, sex, id_number, status, create_time, update_time, create_user, update_user) values " +
            "(#{username}, #{name}, #{password}, #{phone}, #{sex}, #{idNumber}, #{status}, #{createTime}, #{updateTime}, #{createUser}, #{updateUser})")
    @AutoFill(OperationType.INSERT)
    int insert(Employee employee);



}
